__max_num_config_instances: &max_num_config_instances 2

module_name: battery

parameters:
    - group: Battery Calibration
      definitions:
        BAT${i}_V_EMPTY:
            description:
                short: Empty cell voltage (5C load)
                long: |
                    Defines the voltage where a single cell of battery 1 is considered empty.
                    The voltage should be chosen before the steep dropoff to 2.8V. A typical
                    lithium battery can only be discharged down to 10% before it drops off
                    to a voltage level damaging the cells.

            type: float
            unit: V
            decimal: 2
            increment: 0.01
            reboot_required: true
            num_instances: *max_num_config_instances
            instance_start: 1
            default: [3.6, 3.6]

        BAT${i}_V_CHARGED:
            description:
                short: Full cell voltage (5C load)
                long: |
                    Defines the voltage where a single cell of battery 1 is considered full
                    under a mild load. This will never be the nominal voltage of 4.2V

            type: float
            unit: V
            decimal: 2
            increment: 0.01
            reboot_required: true
            num_instances: *max_num_config_instances
            instance_start: 1
            default: [4.05, 4.05]

        BAT${i}_V_LOAD_DROP:
            description:
                short: Voltage drop per cell on full throttle
                long: |
                    This implicitly defines the internal resistance
                    to maximum current ratio for battery 1 and assumes linearity.
                    A good value to use is the difference between the
                    5C and 20-25C load. Not used if BAT${i}_R_INTERNAL is
                    set.

            type: float
            unit: V
            min: 0.07
            max: 0.5
            decimal: 2
            increment: 0.01
            reboot_required: true
            num_instances: *max_num_config_instances
            instance_start: 1
            default: [0.1, 0.1]

        BAT${i}_R_INTERNAL:
            description:
                short: Explicitly defines the per cell internal resistance for battery ${i}
                long: |
                    If non-negative, then this will be used in place of
                    BAT${i}_V_LOAD_DROP for all calculations.

            type: float
            unit: Ohm
            min: -1.0
            max: 0.2
            decimal: 4
            increment: 0.0005
            reboot_required: true
            num_instances: *max_num_config_instances
            instance_start: 1
            default: [0.005, 0.005]

        BAT${i}_N_CELLS:
            description:
                short: Number of cells for battery ${i}.
                long: |
                    Defines the number of cells the attached battery consists of.

            type: enum
            values:
                1: 1S Battery
                2: 2S Battery
                3: 3S Battery
                4: 4S Battery
                5: 5S Battery
                6: 6S Battery
                7: 7S Battery
                8: 8S Battery
                9: 9S Battery
                10: 10S Battery
                11: 11S Battery
                12: 12S Battery
                13: 13S Battery
                14: 14S Battery
                15: 15S Battery
                16: 16S Battery
            reboot_required: true
            num_instances: *max_num_config_instances
            instance_start: 1
            default: [0, 0]

        BAT${i}_CAPACITY:
            description:
                short: Battery ${i} capacity.
                long: |
                    Defines the capacity of battery ${i} in mAh.
            type: float
            unit: mAh
            min: -1.0
            max: 100000
            decimal: 0
            increment: 50
            reboot_required: true
            num_instances: *max_num_config_instances
            instance_start: 1
            default: [-1.0, -1.0]

        BAT${i}_SOURCE:
            description:
                short: Battery ${i} monitoring source.
                long: |
                    This parameter controls the source of battery data. The value 'Power Module'
                    means that measurements are expected to come from a power module. If the value is set to
                    'External' then the system expects to receive mavlink battery status messages.
                    If the value is set to 'ESCs', the battery information are taken from the esc_status message.
                    This requires the ESC to provide both voltage as well as current.
            type: enum
            values:
                -1: Disabled
                0: Power Module
                1: External
                2: ESCs
            reboot_required: true
            num_instances: *max_num_config_instances
            instance_start: 1
            default: [0, -1]
